<template>
  <div class="app-container">

    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="120px">
      <el-form-item label="教师姓名" prop="teacherName">
        <el-input v-model="queryParams.teacherName" placeholder="请输入教师姓名" clearable @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label="联系方式" prop="teacherPhone">
        <el-input v-model="queryParams.teacherPhone" placeholder="请输入联系方式" clearable
          @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label="身份证号" prop="teacherResidentId">
        <el-input v-model="queryParams.teacherResidentId" placeholder="请输入教师身份证号" clearable
          @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label="教师性别" prop="teacherGender">
        <el-select v-model="queryParams.teacherGender" placeholder="请选择教师性别" clearable>
          <el-option v-for="dict in dict.type.sys_user_sex" :key="dict.value" :label="dict.label" :value="dict.value" />
        </el-select>
      </el-form-item>
      <el-form-item label="教师年龄" prop="teacherAge">
        <el-input v-model="queryParams.teacherAge" placeholder="请输入教师年龄" clearable @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label="教师学校" prop="teacherSchool">
        <el-input v-model="queryParams.teacherSchool" placeholder="请输入教师学校" clearable
          @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label="教师专业" prop="teacherSpeciality">
        <el-input v-model="queryParams.teacherSpeciality" placeholder="请输入教师专业" clearable
          @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label="教师身份" prop="teacherIdentity">
        <el-input v-model="queryParams.teacherIdentity" placeholder="请输入教师身份" clearable
          @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label="教师教龄" prop="teachingLength">
        <el-select v-model="queryParams.teachingLength" placeholder="请选择教师教龄" clearable>
          <el-option v-for="dict in dict.type.teaching_length" :key="dict.value" :label="dict.label"
            :value="dict.value" />
        </el-select>
      </el-form-item>
      <el-form-item label="授课方式" prop="teachingMethod">
        <el-select v-model="queryParams.teachingMethod" placeholder="请选择授课方式" clearable>
          <el-option v-for="dict in dict.type.teaching_method" :key="dict.value" :label="dict.label"
            :value="dict.value" />
        </el-select>
      </el-form-item>
      <el-form-item label="家教时间" prop="teachingTime">
        <el-input v-model="queryParams.teachingTime" placeholder="请输入家教时间" clearable
          @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label="家教费用" prop="teachingPrice">
        <el-input v-model="queryParams.teachingPrice" placeholder="请输入家教费用" clearable
          @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label="家教区域" prop="teachingArea">
        <el-select v-model="queryParams.teachingArea" placeholder="请选择家教区域" clearable>
          <el-option v-for="dict in dict.type.parenting_area" :key="dict.value" :label="dict.label"
            :value="dict.value" />
        </el-select>
      </el-form-item>
      <el-form-item label="居住地址" prop="teacherAddress">
        <el-input v-model="queryParams.teacherAddress" placeholder="请输入居住地址" clearable
          @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label="家教科目" prop="teachingParentingSubjects">
        <el-select v-model="queryParams.teachingParentingSubjects" placeholder="请选择家教科目" clearable>
          <el-option v-for="dict in dict.type.parenting_subjects" :key="dict.value" :label="dict.label"
            :value="dict.value" />
        </el-select>
      </el-form-item>
      <el-form-item label="自我描述" prop="teacherDescribe">
        <el-input v-model="queryParams.teacherDescribe" placeholder="请输入自我描述" clearable
          @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label="家教经验" prop="teacherExperience">
        <el-input v-model="queryParams.teacherExperience" placeholder="请输入家教经验" clearable
          @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label="所获证书" prop="teacherCertificate">
        <el-input v-model="queryParams.teacherCertificate" placeholder="请输入所获证书" clearable
          @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label="教员要求" prop="teacherRequirements">
        <el-input v-model="queryParams.teacherRequirements" placeholder="请输入教员要求" clearable
          @keyup.enter.native="handleQuery" />
      </el-form-item>
      <!--  <el-form-item label="最近登录时间" prop="recentLoginTime">
        <el-date-picker clearable v-model="queryParams.recentLoginTime" type="date" value-format="yyyy-MM-dd"
          placeholder="请选择最近登录时间">
        </el-date-picker>
      </el-form-item> -->
      <el-form-item label="是否热门" prop="remark2">
        <el-select v-model="queryParams.remark2" placeholder="请选择审核状态" clearable>
          <el-option v-for="dict in dict.type.teacher_popular" :key="dict.value" :label="dict.label"
            :value="dict.value" />
        </el-select>
      </el-form-item>
      <el-form-item label="审核状态" prop="auditStatus">
        <el-select v-model="queryParams.auditStatus" placeholder="请选择审核状态" clearable>
          <el-option v-for="dict in dict.type.audit_status" :key="dict.value" :label="dict.label" :value="dict.value" />
        </el-select>
      </el-form-item>
      <!-- <el-input
          v-model="queryParams.remark5"
          placeholder="请输入审核状态"
          clearable
          @keyup.enter.native="handleQuery"
        /> -->

      <!-- <el-form-item label="${comment}" prop="remark1">
        <el-input
          v-model="queryParams.remark1"
          placeholder="请输入${comment}"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item> -->
      <!-- <el-form-item label="${comment}" prop="remark2">
        <el-input
          v-model="queryParams.remark2"
          placeholder="请输入${comment}"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item> -->
      <!-- <el-form-item label="${comment}" prop="remark3">
        <el-input
          v-model="queryParams.remark3"
          placeholder="请输入${comment}"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item> -->
      <!-- <el-form-item label="${comment}" prop="remark4">
        <el-input
          v-model="queryParams.remark4"
          placeholder="请输入${comment}"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item> -->
      <!-- <el-form-item label="${comment}" prop="remark5">
        <el-input
          v-model="queryParams.remark5"
          placeholder="请输入${comment}"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item> -->
      <!-- <el-form-item label="${comment}" prop="remark6">
        <el-input
          v-model="queryParams.remark6"
          placeholder="请输入${comment}"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item> -->
      <!-- <el-form-item label="${comment}" prop="remark7">
        <el-input
          v-model="queryParams.remark7"
          placeholder="请输入${comment}"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item> -->
      <!-- <el-form-item label="${comment}" prop="remark8">
        <el-input
          v-model="queryParams.remark8"
          placeholder="请输入${comment}"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item> -->
      <!-- <el-form-item label="${comment}" prop="remark9">
        <el-input
          v-model="queryParams.remark9"
          placeholder="请输入${comment}"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item> -->
      <!-- <el-form-item label="${comment}" prop="remark10">
        <el-input
          v-model="queryParams.remark10"
          placeholder="请输入${comment}"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item> -->
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
          v-hasPermi="['teacher:teacherlist:add']">新增</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button type="success" plain icon="el-icon-edit" size="mini" :disabled="single" @click="handleUpdate"
          v-hasPermi="['teacher:teacherlist:edit']">修改</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete"
          v-hasPermi="['teacher:teacherlist:remove']">删除</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport"
          v-hasPermi="['teacher:teacherlist:export']">导出</el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <el-table v-loading="loading" :data="teacherlistList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column label="序号" align="center" prop="id" />
      <el-table-column label="教师姓名" align="center" prop="teacherName" />
      <!-- <el-table-column label="是否热门" align="center" prop="remark2" /> -->
      <el-table-column label="是否热门" align="center" prop="auditStatus">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.teacher_popular" :value="scope.row.remark2" />
        </template>
      </el-table-column>
      
      <el-table-column label="审核状态" align="center" prop="auditStatus">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.audit_status" :value="scope.row.auditStatus" />
        </template>
      </el-table-column>
      <el-table-column label="联系方式" align="center" prop="teacherPhone" />
      <el-table-column label="身份证号" align="center" prop="teacherResidentId" width="200" />
      <el-table-column label="教师性别" align="center" prop="teacherGender">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.sys_user_sex" :value="scope.row.teacherGender" />
        </template>
      </el-table-column>
      <el-table-column label="教师年龄" align="center" prop="teacherAge" />
      <el-table-column label="教师学校" align="center" prop="teacherSchool" width="200" />
      <el-table-column label="教师专业" align="center" prop="teacherSpeciality" />
      <el-table-column label="教师身份" align="center" prop="teacherIdentity" />
      <el-table-column label="教师教龄" align="center" prop="teachingLength">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.teaching_length" :value="scope.row.teachingLength" />
        </template>
      </el-table-column>
      <el-table-column label="授课方式" align="center" prop="teachingMethod">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.teaching_method" :value="scope.row.teachingMethod" />
        </template>
      </el-table-column>
      <el-table-column label="家教时间" align="center" prop="teachingTime" />
      <el-table-column label="家教费用" align="center" prop="teachingPrice" />
      <el-table-column label="家教区域" align="center" prop="teachingArea" width="120">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.parenting_area" :value="scope.row.teachingArea" />
        </template>
      </el-table-column>
      <el-table-column label="居住地址" align="center" prop="teacherAddress" />
      <el-table-column label="家教科目" align="center" prop="teachingParentingSubjects">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.parenting_subjects" :value="scope.row.teachingParentingSubjects" />
        </template>
      </el-table-column>
      <el-table-column label="自我描述" align="center" prop="teacherDescribe" />
      <el-table-column label="家教经验" align="center" prop="teacherExperience" />
      <el-table-column label="所获证书" align="center" prop="teacherCertificate" />
      <el-table-column label="教员要求" align="center" prop="teacherRequirements" />
      <el-table-column label="最近登录时间" align="center" prop="recentLoginTime" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.recentLoginTime, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>

      <!-- <el-table-column label="简历照片" align="center" prop="remark1" /> -->
      <el-table-column label="身份证正面" align="center" prop="idcardFrontPhoto" width="180">

        <template slot-scope="scope">


          <el-image style="width: 100px; height: 100px" :src="reverseMessage+scope.row.idcardFrontPhoto"
            @click="see(scope.row.idcardFrontPhoto)" fit="fill"></el-image>

        </template>
      </el-table-column>
      <el-table-column label="身份证反面" align="center" prop="idcardBackPhoto" width="180">
        <template slot-scope="scope">
          <el-image style="width: 100px; height: 100px" :src="reverseMessage+scope.row.idcardBackPhoto"
            @click="see(scope.row.idcardBackPhoto)" fit="fill"></el-image>
        </template>
      </el-table-column>
      <el-table-column label="证书照片" align="center" prop="certificatePhoto" width="180">
        <template slot-scope="scope">
          <!-- {{reverseMessage+scope.row.remark4}} -->
          <el-image style="width: 100px; height: 100px" @click="see(scope.row.certificatePhoto)"
            :src="reverseMessage+scope.row.certificatePhoto" fit="fill"></el-image>

        </template>
      </el-table-column>
      <el-table-column label="纬度" align="center" prop="remark3" />
      <el-table-column label="经度" align="center" prop="remark4" />

      <el-table-column label="完成状态" align="center" prop="state" />


      <!-- <el-table-column label="${comment}" align="center" prop="remark5" /> -->
      <!-- <el-table-column label="${comment}" align="center" prop="remark6" /> -->
      <!-- <el-table-column label="${comment}" align="center" prop="remark7" /> -->
      <!-- <el-table-column label="${comment}" align="center" prop="remark8" /> -->
      <!-- <el-table-column label="${comment}" align="center" prop="remark9" /> -->
      <!-- <el-table-column label="${comment}" align="center" prop="remark10" /> -->
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right">
        <template slot-scope="scope">
          <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
            v-hasPermi="['teacher:teacherlist:edit']">修改</el-button>
          <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
            v-hasPermi="['teacher:teacherlist:remove']">删除</el-button>
        </template>
      </el-table-column>
    </el-table>

    <pagination v-show="total>0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
      @pagination="getList" />

    <!-- 添加或修改教师列表对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body :close-on-click-modal="false">
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
        <el-form-item label="教师姓名" prop="teacherName">
          <el-input v-model="form.teacherName" placeholder="请输入教师姓名" />
        </el-form-item>
        <el-form-item label="联系方式" prop="teacherPhone">
          <el-input v-model="form.teacherPhone" placeholder="请输入联系方式" />
        </el-form-item>
        <el-form-item label="身份证号" prop="teacherResidentId">
          <el-input v-model="form.teacherResidentId" placeholder="请输入教师身份证号" />
        </el-form-item>
        <el-form-item label="教师性别" prop="teacherGender">
          <el-select v-model="form.teacherGender" placeholder="请选择教师性别">
            <el-option v-for="dict in dict.type.sys_user_sex" :key="dict.value" :label="dict.label" :value="dict.value">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="教师年龄" prop="teacherAge">
          <el-input v-model="form.teacherAge" placeholder="请输入教师年龄" />
        </el-form-item>
        <el-form-item label="教师学校" prop="teacherSchool">
          <el-input v-model="form.teacherSchool" placeholder="请输入教师学校" />
        </el-form-item>
        <el-form-item label="教师专业" prop="teacherSpeciality">
          <el-input v-model="form.teacherSpeciality" placeholder="请输入教师专业" />
        </el-form-item>
        <el-form-item label="教师身份" prop="teacherIdentity">
          <el-input v-model="form.teacherIdentity" placeholder="请输入教师身份" />
        </el-form-item>
        <el-form-item label="教师教龄" prop="teachingLength">
          <el-select v-model="form.teachingLength" placeholder="请选择教师教龄">
            <el-option v-for="dict in dict.type.teaching_length" :key="dict.value" :label="dict.label"
              :value="dict.value"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="授课方式" prop="teachingMethod">
          <el-select v-model="form.teachingMethod" placeholder="请选择授课方式">
            <el-option v-for="dict in dict.type.teaching_method" :key="dict.value" :label="dict.label"
              :value="dict.value"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="家教时间" prop="teachingTime">
          <el-input v-model="form.teachingTime" placeholder="请输入家教时间" />
        </el-form-item>
        <el-form-item label="家教费用" prop="teachingPrice">
          <el-input v-model="form.teachingPrice" placeholder="请输入家教费用" />
        </el-form-item>
        <el-form-item label="家教区域" prop="teachingArea">
          <el-select v-model="form.teachingArea" placeholder="请选择家教区域">
            <el-option v-for="dict in dict.type.parenting_area" :key="dict.value" :label="dict.label"
              :value="dict.value"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="居住地址" prop="teacherAddress">
          <el-input v-model="form.teacherAddress" placeholder="请输入居住地址" />
        </el-form-item>
        <el-form-item label="家教科目" prop="teachingParentingSubjects">
          <el-select v-model="form.teachingParentingSubjects" placeholder="请选择家教科目">
            <el-option v-for="dict in dict.type.parenting_subjects" :key="dict.value" :label="dict.label"
              :value="dict.value"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="自我描述" prop="teacherDescribe">
          <el-input v-model="form.teacherDescribe" placeholder="请输入自我描述" />
        </el-form-item>
        <el-form-item label="家教经验" prop="teacherExperience">
          <el-input v-model="form.teacherExperience" placeholder="请输入家教经验" />
        </el-form-item>
        <el-form-item label="所获证书" prop="teacherCertificate">
          <el-input v-model="form.teacherCertificate" placeholder="请输入所获证书" />
        </el-form-item>
        <el-form-item label="教员要求" prop="teacherRequirements">
          <el-input v-model="form.teacherRequirements" placeholder="请输入教员要求" />
        </el-form-item>
        <!-- <el-form-item label="最近登录时间" prop="recentLoginTime">
          <el-date-picker clearable v-model="form.recentLoginTime" type="date" value-format="yyyy-MM-dd"
            placeholder="请选择最近登录时间">
          </el-date-picker>
        </el-form-item> -->
        <el-form-item label="是否热门" prop="remark2">
          <el-select v-model="form.remark2" placeholder="请选择审核状态" clearable>
            <el-option v-for="dict in dict.type.teacher_popular" :key="dict.value" :label="dict.label"
              :value="dict.value" />
          </el-select>
        </el-form-item>
        <el-form-item label="审核状态" prop="auditStatus">
          <el-select v-model="form.auditStatus" placeholder="请选择审核状态">
            <el-option v-for="dict in dict.type.audit_status" :key="dict.value" :label="dict.label" :value="dict.value">
            </el-option>
          </el-select>
        </el-form-item>
        <!-- <el-form-item label="完成状态" prop="state">
          <el-input v-model="form.state" placeholder="请输入完成状态" />
        </el-form-item> -->
        <!-- <el-form-item label="删除标志" prop="delFlag">
          <el-input v-model="form.delFlag" placeholder="请输入删除标志" />
        </el-form-item> -->
        <!--  <el-form-item label="${comment}" prop="remark1">
          <el-input v-model="form.remark1" placeholder="请输入${comment}" />
        </el-form-item> -->
        <!-- <el-form-item label="${comment}" prop="remark2">
          <el-input v-model="form.remark2" placeholder="请输入${comment}" />
        </el-form-item>  -->
        <!-- <el-form-item label="${comment}" prop="remark3">
          <el-input v-model="form.remark3" placeholder="请输入${comment}" />
        </el-form-item> -->
        <!-- <el-form-item label="${comment}" prop="remark4">
          <el-input v-model="form.remark4" placeholder="请输入${comment}" />
        </el-form-item> -->
        <!-- <el-form-item label="${comment}" prop="remark5">
          <el-input v-model="form.remark5" placeholder="请输入${comment}" />
        </el-form-item> -->
        <!-- <el-form-item label="${comment}" prop="remark6">
          <el-input v-model="form.remark6" placeholder="请输入${comment}" />
        </el-form-item> -->
        <!-- <el-form-item label="${comment}" prop="remark7">
          <el-input v-model="form.remark7" placeholder="请输入${comment}" />
        </el-form-item> -->
        <!-- <el-form-item label="${comment}" prop="remark8">
          <el-input v-model="form.remark8" placeholder="请输入${comment}" />
        </el-form-item> -->
        <!-- <el-form-item label="${comment}" prop="remark9">
          <el-input v-model="form.remark9" placeholder="请输入${comment}" />
        </el-form-item> -->
        <!-- <el-form-item label="${comment}" prop="remark10">
          <el-input v-model="form.remark10" placeholder="请输入${comment}" />
        </el-form-item> -->
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>


    <el-dialog title="查看图片" :visible.sync="openimage" width="80%" append-to-body>
      <el-image :src="imageurl" fit="fill"></el-image>

    </el-dialog>
  </div>
</template>

<script>
  import {
    listTeacherlist,
    getTeacherlist,
    delTeacherlist,
    addTeacherlist,
    updateTeacherlist
  } from "@/api/teacher/teacherlist";

  import request from '@/utils/request'
  export default {
    name: "Teacherlist",
    dicts: ['parenting_subjects', 'audit_status', 'teaching_length', 'parenting_area', 'teaching_method',
      'sys_user_sex', 'teacher_popular'
    ],

    data() {
      return {
        url: process.env.VUE_APP_BASE_API,
        // 遮罩层
        loading: true,
        // 选中数组
        ids: [],
        // 非单个禁用
        single: true,
        // 非多个禁用
        multiple: true,
        // 显示搜索条件
        showSearch: true,
        // 总条数
        total: 0,
        // 教师列表表格数据
        teacherlistList: [],
        // 弹出层标题
        title: "",
        // 是否显示弹出层
        open: false,
        // 查询参数
        queryParams: {
          pageNum: 1,
          pageSize: 10,
          teacherName: null,
          teacherPhone: null,
          teacherResidentId: null,
          teacherGender: null,
          teacherAge: null,
          teacherSchool: null,
          teacherSpeciality: null,
          teacherIdentity: null,
          teachingLength: null,
          teachingMethod: null,
          teachingTime: null,
          teachingPrice: null,
          teachingArea: null,
          teacherAddress: null,
          teachingParentingSubjects: null,
          teacherDescribe: null,
          teacherExperience: null,
          teacherCertificate: null,
          teacherRequirements: null,
          recentLoginTime: null,
          state: null,
          remark1: null,
          remark2: null,
          remark3: null,
          remark4: null,
          remark5: null,
          remark6: null,
          remark7: null,
          remark8: null,
          remark9: null,
          remark10: null
        },
        // 表单参数
        form: {},
        // 表单校验
        rules: {},
        srcList: [],
        openimage: false,
        imageurl: ""
      };
    },
    created() {
      console.log(this.url)
      this.getList();
    },
    computed: {
      reverseMessage(data) {


        return process.env.VUE_APP_BASE_API;
      }
    },

    methods: {
      see(data) {
        this.openimage = true;

        this.imageurl = process.env.VUE_APP_BASE_API + data;


      },
      /** 查询教师列表列表 */
      getList() {
        this.loading = true;
        listTeacherlist(this.queryParams).then(response => {
          this.teacherlistList = response.rows;
          this.total = response.total;
          this.loading = false;
        });
      },
      // 取消按钮
      cancel() {
        this.open = false;
        this.reset();
      },
      // 表单重置
      reset() {
        this.form = {
          pageNum: 1,
          pageSize: 10,
          teacherName: null,
          teacherPhone: null,
          teacherResidentId: null,
          teacherGender: null,
          teacherAge: null,
          teacherSchool: null,
          teacherSpeciality: null,
          teacherIdentity: null,
          teachingLength: null,
          teachingMethod: null,
          teachingTime: null,
          teachingPrice: null,
          teachingArea: null,
          teacherAddress: null,
          teachingParentingSubjects: null,
          teacherDescribe: null,
          teacherExperience: null,
          teacherCertificate: null,
          teacherRequirements: null,
          recentLoginTime: null,
          resumePhoto: null,
          idcardFrontPhoto: null,
          idcardBackPhoto: null,
          auditStatus: null,
          certificatePhoto: null,
          state: null,
          remark1: null,
          remark2: null,
          remark3: null,
          remark4: null,
          remark5: null,
          remark6: null,
          remark7: null,
          remark8: null,
          remark9: null,
          remark10: null
        };
        this.resetForm("form");
      },
      /** 搜索按钮操作 */
      handleQuery() {
        this.queryParams.pageNum = 1;
        this.getList();
      },
      /** 重置按钮操作 */
      resetQuery() {
        this.resetForm("queryForm");
        this.handleQuery();
      },
      // 多选框选中数据
      handleSelectionChange(selection) {
        this.ids = selection.map(item => item.id)
        this.single = selection.length !== 1
        this.multiple = !selection.length
      },
      /** 新增按钮操作 */
      handleAdd() {
        this.reset();
        this.open = true;
        this.title = "添加教师列表";
      },
      /** 修改按钮操作 */
      handleUpdate(row) {
        this.reset();
        const id = row.id || this.ids
        getTeacherlist(id).then(response => {
          this.form = response.data;
          this.open = true;
          this.title = "修改教师列表";
        });
      },
      /** 提交按钮 */
      submitForm() {
        this.$refs["form"].validate(valid => {
          if (valid) {
            if (this.form.id != null) {
              updateTeacherlist(this.form).then(response => {
                this.$modal.msgSuccess("修改成功");
                this.open = false;
                this.getList();
              });
            } else {
              addTeacherlist(this.form).then(response => {
                this.$modal.msgSuccess("新增成功");
                this.open = false;
                this.getList();
              });
            }
          }
        });
      },
      /** 删除按钮操作 */
      handleDelete(row) {
        const ids = row.id || this.ids;
        this.$modal.confirm('是否确认删除教师列表编号为"' + ids + '"的数据项？').then(function() {
          return delTeacherlist(ids);
        }).then(() => {
          this.getList();
          this.$modal.msgSuccess("删除成功");
        }).catch(() => {});
      },
      /** 导出按钮操作 */
      handleExport() {
        this.download('teacher/teacherlist/export', {
          ...this.queryParams
        }, `teacherlist_${new Date().getTime()}.xlsx`)
      }
    }
  };
</script>
